/**
 * 
 */
package neptune.web.server.operations;

import it.robertobifulco.ias.IncorrectParamsException;
import it.robertobifulco.ias.Operation;
import neptune.manager.model.experiment.Experiment;
import neptune.manager.validator.ValidatorResult;
import neptune.web.server.ApplicationManager;

/**
 * @author Roberto Bifulco [RobertoBifulco.it] [info@robertoBifulco.it]
 * 
 */
public class ValidateTopology implements Operation {

	public static String ID = "ValidateTopology";

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#execute(java.lang.Object[])
	 */
	/**
	 * Convalida un esperimento.
	 * 
	 * @param args[0] = String expId
	 * @return ValidatorResult
	 */
	public Object[] execute(Object[] args) throws IncorrectParamsException,
			Exception {
		String expId = (String) args[0];

		Experiment exp = ApplicationManager.getApplicationManager()
				.getNeptuneManager().getExperiment(expId);
		ValidatorResult result = ApplicationManager.getApplicationManager()
				.getNeptuneManager().validateExperimentTopology(exp);

		return new Object[] { result };
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#getDescription()
	 */
	public String getDescription() {
		return "Validate a topology linked to an experiment";
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#getID()
	 */
	public String getID() {
		return ID;
	}

}
